package com.yonyou.cyxdms.basedata.client.domains.vo;

import com.yonyou.cyx.function.utils.bean.BeanMapperUtil;
import com.yonyou.cyx.function.utils.jsonserializer.JSONUtil;

import java.util.Map;

/**
 * 存入MQ的VO
 *
 * @author ysj
 * @since 11:16 2019-10-22
 */
public class MQBaseVO<T>{
    /**
     * APPID
     */
    private String appId;

    /**
     * 经销商代码
     */
    private String ownerCode;

    private T data;

    public MQBaseVO(T vo, String appId, String ownerCode){
        this.data = vo;
        this.appId = appId;
        this.ownerCode = ownerCode;
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getOwnerCode() {
        return ownerCode;
    }

    public void setOwnerCode(String ownerCode) {
        this.ownerCode = ownerCode;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public Map<String,Object> toMap(){
        return BeanMapperUtil.toMap(this);
    }

    public String toJson(){
        return JSONUtil.objectToJson(this);
    }

    @Override
    public String toString() {
        return "MQBaseVO{" +
                "appId='" + appId + '\'' +
                ", ownerCode='" + ownerCode + '\'' +
                ", data=" + data +
                '}';
    }
}
